/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pruebaes.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author luisfernando
 */
@Entity
@Table(name = "requeridospermiso")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Requeridospermiso.findAll", query = "SELECT r FROM Requeridospermiso r"),
    @NamedQuery(name = "Requeridospermiso.findById", query = "SELECT r FROM Requeridospermiso r WHERE r.id = :id"),
    @NamedQuery(name = "Requeridospermiso.findByDocumento", query = "SELECT r FROM Requeridospermiso r WHERE r.documento = :documento"),
    @NamedQuery(name = "Requeridospermiso.findByMandatorio", query = "SELECT r FROM Requeridospermiso r WHERE r.mandatorio = :mandatorio"),
    @NamedQuery(name = "Requeridospermiso.findByRiesgo", query = "SELECT r FROM Requeridospermiso r WHERE r.riesgo = :riesgo")})
public class Requeridospermiso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 2147483647)
    @Column(name = "documento")
    private String documento;
    @Column(name = "mandatorio")
    private Boolean mandatorio;
    @Size(max = 2147483647)
    @Column(name = "riesgo")
    private String riesgo;
    @Lob
    @Column(name = "archivo")
    private byte[] archivo;
    @JoinColumn(name = "permiso", referencedColumnName = "id")
    @ManyToOne
    private Permisos permiso;

    public Requeridospermiso() {
    }

    public Requeridospermiso(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDocumento() {
        return documento;
    }

    public void setDocumento(String documento) {
        this.documento = documento;
    }

    public Boolean getMandatorio() {
        return mandatorio;
    }

    public void setMandatorio(Boolean mandatorio) {
        this.mandatorio = mandatorio;
    }

    public String getRiesgo() {
        return riesgo;
    }

    public void setRiesgo(String riesgo) {
        this.riesgo = riesgo;
    }

    public byte[] getArchivo() {
        return archivo;
    }

    public void setArchivo(byte[] archivo) {
        this.archivo = archivo;
    }

    public Permisos getPermiso() {
        return permiso;
    }

    public void setPermiso(Permisos permiso) {
        this.permiso = permiso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Requeridospermiso)) {
            return false;
        }
        Requeridospermiso other = (Requeridospermiso) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.pruebaes.entidades.Requeridospermiso[ id=" + id + " ]";
    }
    
}
